﻿using System;
using System.Collections.Generic;
using System.Text;

using DotSpatial.Data;
using DotSpatial.Geometries;



namespace HuanGis
{
    public class FSquareShape : FShape
    {

        public FSquareShape(Coordinate[] Points, string id)
            : base(id)
        {

            this.normalPts.AddRange(Points);
            this.KeyPts.AddRange(Points);
          
        }


        /// <summary>
        /// 
        /// </summary>
        /// <param name="LeftTopPoint">左上角坐标</param>
        /// <param name="Length">边长</param>
        /// <param name="id"></param>
        public FSquareShape(Coordinate LeftTopPoint, double Length, string id)
            : base(id)
        {
            this.ComputePoints(LeftTopPoint, Length);
        }

        protected void ComputePoints(Coordinate LeftTopPoint, double Length)
        {
            this.normalPts.Add(LeftTopPoint);
            this.KeyPts.Add(LeftTopPoint);

            Coordinate RightTopPoint = new Coordinate();
            RightTopPoint.X = LeftTopPoint.X + Length;
            RightTopPoint.Y = LeftTopPoint.Y;
            this.normalPts.Add(RightTopPoint);
            this.KeyPts.Add(RightTopPoint);

            Coordinate RightBottomPoint = new Coordinate();
            RightBottomPoint.X = RightTopPoint.X;
            RightBottomPoint.Y = LeftTopPoint.Y - Length;
            this.normalPts.Add(RightBottomPoint);
            this.KeyPts.Add(RightBottomPoint);

            Coordinate LeftBottomPoint = new Coordinate();
            LeftBottomPoint.X = LeftTopPoint.X;
            LeftBottomPoint.Y = RightBottomPoint.Y;
            this.normalPts.Add(LeftBottomPoint);
            this.KeyPts.Add(LeftBottomPoint);
        
        }


    }
}
